home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 8 / QRZ Ham Radio Callsign Database - Volume 8.iso / pc / files / t_sys5 / unixkit.tgz / unixkit.tar / unixkit / README < prev    next >
Text File  |  1992-01-13  |  16KB  |  610 lines

  1.  
  2. NOS on SunOS
  3.  
  4. Mike Westerhof, KA9WSB
  5.  
  6. November, 1991
  7.  
  8.  
  9.  
  10.  
  11. This kit is intended to help folks port NOS to UNIX systems.  It is primarily
  12. intended for Sun users, but I suspect many of the techniques are also
  13. applicable to other UNIX systems.
  14.  
  15.  
  16.  
  17.  
  18. The contents of this kit are broken into several directories:
  19.  
  20. common:        The modified source files needed for any UNIX version
  21.  
  22. lwp:        The Sun LWP library specific files
  23.  
  24. thread:        The longjmp/setjmp alternative to the LWP stuff (works
  25.         better, for the most part)
  26.  
  27. old_OS:        Some fake/hacked system include files for SunOS releases
  28.         4.0.2 and 4.0.3.  This stuff is not required for SunOS 4.1
  29.  
  30. tundrvr:    A copy of Julian Onion's tunnel driver for your UNIX OS
  31.  
  32. test:        An incomplete directory structure for testing NOS
  33.  
  34.  
  35.  
  36.  
  37. The porting procedure is relatively simple, if somewhat tedious:
  38.  
  39. % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
  40.  
  41. a) Obtain a copy of NOS to port.  This document describes the PA0GRI v1.7j
  42.    version, but most NOS versions based on the same KA9Q core should port
  43.    with minor changes.
  44.  
  45. % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
  46.  
  47. b) Convert the NOS ".ZIP" file to a standard UNIX format.  The easiest way
  48.    is to unzip the source on a PC or on a PC emulator.  You can ftp the
  49.    the source to the UNIX machine, or you can use the "dos2unix" command
  50.    on SunOS to convert the DOS text format to UNIX format.
  51.  
  52. % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
  53.  
  54. c) Copy the contents of the "common" directory into your NOS source
  55.    directory.  You will probably want to keep the original versions
  56.    of the modified routines.
  57.  
  58. % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
  59.  
  60. d) Rename the NOS "makefile" to "makefile.old" or something.
  61.  
  62. % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
  63.  
  64. e) Copy the contents of the "thread" directory into your NOS source
  65.    directory.  Again, you will want to keep the original versions around
  66.    somewhere.
  67.  
  68. % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
  69.  
  70. f) The 8250.h file is no longer necessary.  The easiest way to fix it
  71.    is to add a "#ifndef UNIX" at the top, and a "#endif" at the bottom,
  72.    like so:
  73.  
  74. *** grinos.orig/8250.h    Wed Nov 20 16:05:32 1991
  75. --- g/8250.h    Tue Nov 26 10:29:44 1991
  76. ***************
  77. *** 1,5 ****
  78. --- 1,6 ----
  79.   /* Various I/O definitions specific to asynch I/O on the IBM PC */
  80.   /* Mods by G1EMM */
  81. + #ifndef UNIX
  82.   #ifndef    _8250_H
  83.   #define    _8250_H
  84.   
  85. ***************
  86. *** 164,166 ****
  87. --- 165,168 ----
  88.   INTERRUPT asy4vec __ARGS((void));
  89.   
  90.   #endif    /* _8250_H */
  91. + #endif  /* not UNIX */
  92.  
  93. % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
  94.  
  95. g) The hardware.h file will give you a little grief; get rid of the
  96.    "clrbit" and "setbit" definitions.
  97.  
  98. % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
  99.  
  100. h) There is a little nasty bit of code in kernel.c that needs to
  101.    be fixed to use the normal "free" technique.  See the comments
  102.    in "bsdunix.c" for details, but start with this change:
  103.  
  104. *** grinos.orig/kernel.c    Fri Nov 22 10:05:50 1991
  105. --- g/kernel.c    Tue Nov 26 10:35:15 1991
  106. ***************
  107. *** 167,174 ****
  108.       /* Free allocated memory resources */
  109.       if(pp->freeargs){
  110.           argv = pp->parg1;
  111. !         while(pp->iarg-- != 0)
  112. !             free(*argv++);
  113.           free(pp->parg1);
  114.       }
  115.       free(pp->name);
  116. --- 167,176 ----
  117.       /* Free allocated memory resources */
  118.       if(pp->freeargs){
  119.           argv = pp->parg1;
  120. !         while(pp->iarg-- != 0){
  121. !             free(*argv);
  122. !             argv++;
  123. !         }
  124.           free(pp->parg1);
  125.       }
  126.       free(pp->name);
  127.  
  128.  
  129. % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
  130.  
  131. i) There is some yucky bit of PC-specific code in NOS that is not
  132.    ifdef'd properly.
  133.  
  134. *** grinos.orig/mbuf.c    Wed Nov 20 16:06:28 1991
  135. --- g/mbuf.c    Tue Nov 26 10:35:25 1991
  136. ***************
  137. *** 37,42 ****
  138. --- 37,43 ----
  139.       while(Intqlen < Nibufs){
  140.           if((bp = alloc_mbuf(Ibufsize)) == NULLBUF)
  141.               break;
  142. + #ifndef UNIX
  143.   #ifndef    notdef        /* Temp hack to satisfy PI DMA requirements */
  144.           dma_abs = ((long)FP_SEG(bp->data) << 4) + (long)FP_OFF(bp->data);
  145.           dma_page = dma_abs >> 16;
  146. ***************
  147. *** 47,52 ****
  148. --- 48,54 ----
  149.               restore(i_state);
  150.               continue;
  151.           }
  152. + #endif
  153.   #endif
  154.   
  155.           i_state = dirps();
  156.  
  157. % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
  158.  
  159. j) And there are plenty of little compiler disagreements; some places in
  160.    NOS where the definition of a function is "extern static int foo()", but
  161.    the actual routine is declared as "int foo()"...  Some things the
  162.    compiler just doesn't like.
  163.  
  164.  
  165. *** grinos.orig/axheard.c    Wed Nov 20 16:05:45 1991
  166. --- g/axheard.c    Tue Nov 26 10:30:11 1991
  167. ***************
  168. *** 11,17 ****
  169.   #include "ip.h"
  170.   #include "timer.h"
  171.   
  172. ! #define iscallsign(c) ((isupper(c)) || (isdigit(c)) || (c =='\x20'))
  173.   int axheard_filter_flag = AXHEARD_PASS;
  174.   
  175.   static struct lq *al_create __ARGS((struct iface *ifp,char *addr));
  176. --- 11,17 ----
  177.   #include "ip.h"
  178.   #include "timer.h"
  179.   
  180. ! #define iscallsign(c) ((isupper(c)) || (isdigit(c)) || (c ==' '))
  181.   int axheard_filter_flag = AXHEARD_PASS;
  182.   
  183.   static struct lq *al_create __ARGS((struct iface *ifp,char *addr));
  184.  
  185.  
  186. *** grinos.orig/bootpcmd.c    Wed Nov 20 16:05:48 1991
  187. --- g/bootpcmd.c    Tue Nov 26 10:30:38 1991
  188. ***************
  189. *** 12,19 ****
  190.   
  191.   
  192.   #include <stdio.h>
  193. ! #include <sys\types.h>
  194. ! #include <sys\stat.h>
  195.   #include <time.h>
  196.   #include <ctype.h>
  197.   #ifdef    ANSIPROTO
  198. --- 12,19 ----
  199.   
  200.   
  201.   #include <stdio.h>
  202. ! #include <sys/types.h>
  203. ! #include <sys/stat.h>
  204.   #include <time.h>
  205.   #include <ctype.h>
  206.   #ifdef    ANSIPROTO
  207.  
  208.  
  209. *** grinos.orig/bootpd.c    Wed Nov 20 16:05:48 1991
  210. --- g/bootpd.c    Tue Nov 26 10:30:55 1991
  211. ***************
  212. *** 18,25 ****
  213.   
  214.   
  215.   #include <stdio.h>
  216. ! #include <sys\types.h>
  217. ! #include <sys\stat.h>
  218.   #include <ctype.h>
  219.   #include <time.h>
  220.   
  221. --- 18,25 ----
  222.   
  223.   
  224.   #include <stdio.h>
  225. ! #include <sys/types.h>
  226. ! #include <sys/stat.h>
  227.   #include <ctype.h>
  228.   #include <time.h>
  229.   
  230. ***************
  231. *** 379,389 ****
  232.   struct iface *iface;
  233.   struct host *hp;
  234.   {
  235. !     char     cookie[5] = {99, 130, 83, 99, 0};
  236.       int     len;
  237.       int    mod;
  238.       int    i;
  239.       char    *sizep;
  240.   
  241.       /* Magic cookie */
  242.       strcpy (vend, cookie); 
  243. --- 379,395 ----
  244.   struct iface *iface;
  245.   struct host *hp;
  246.   {
  247. !     char     cookie[5];
  248.       int     len;
  249.       int    mod;
  250.       int    i;
  251.       char    *sizep;
  252. +     cookie[0] = 99;
  253. +     cookie[1] = 130;
  254. +     cookie[2] = 83;
  255. +     cookie[3] = 99;
  256. +     cookie[4] = 0;
  257.   
  258.       /* Magic cookie */
  259.       strcpy (vend, cookie); 
  260.  
  261.  
  262. *** grinos.orig/bootpdip.c    Wed Nov 20 16:05:49 1991
  263. --- g/bootpdip.c    Tue Nov 26 10:31:07 1991
  264. ***************
  265. *** 904,910 ****
  266.    *      q_enqueue()
  267.    *              Enqueue an element in a simple Q.
  268.    */
  269. ! void
  270.   q_enqueue(queue, elem)
  271.   struct q *queue;
  272.   struct q_elt *elem;
  273. --- 904,910 ----
  274.    *      q_enqueue()
  275.    *              Enqueue an element in a simple Q.
  276.    */
  277. ! static void
  278.   q_enqueue(queue, elem)
  279.   struct q *queue;
  280.   struct q_elt *elem;
  281.  
  282.  
  283. *** grinos.orig/domain.c    Wed Nov 20 16:05:55 1991
  284. --- g/domain.c    Tue Nov 26 10:31:48 1991
  285. ***************
  286. *** 158,164 ****
  287.       return subcmd(Dcmds,argc,argv,p);
  288.   }
  289.   
  290. ! int
  291.   docache(argc,argv,p)
  292.   int argc;
  293.   char *argv[];
  294. --- 158,164 ----
  295.       return subcmd(Dcmds,argc,argv,p);
  296.   }
  297.   
  298. ! static int
  299.   docache(argc,argv,p)
  300.   int argc;
  301.   char *argv[];
  302.  
  303.  
  304. *** grinos.orig/nrcmd.c    Wed Nov 20 16:06:37 1991
  305. --- g/nrcmd.c    Tue Nov 26 10:35:40 1991
  306. ***************
  307. *** 1063,1069 ****
  308.   
  309.       return 0 ;
  310.   }
  311. ! int
  312.   donrload(argc,argv,p)
  313.   int argc ;
  314.   char *argv[] ;
  315. --- 1063,1069 ----
  316.   
  317.       return 0 ;
  318.   }
  319. ! static int
  320.   donrload(argc,argv,p)
  321.   int argc ;
  322.   char *argv[] ;
  323. ***************
  324. *** 1135,1141 ****
  325.       return 0;
  326.   }
  327.   
  328. ! int
  329.   donrsave(argc,argv,p)
  330.   int argc ;
  331.   char *argv[] ;
  332. --- 1135,1141 ----
  333.       return 0;
  334.   }
  335.   
  336. ! static int
  337.   donrsave(argc,argv,p)
  338.   int argc ;
  339.   char *argv[] ;
  340.  
  341.  
  342. *** grinos.orig/popcli.c    Wed Nov 20 16:06:46 1991
  343. --- g/popcli.c    Tue Nov 26 10:35:47 1991
  344. ***************
  345. *** 278,285 ****
  346.       char *cp;
  347.       struct sockaddr_in fsocket;
  348.       struct pop_ccb    *ccb;
  349. !     void pop_csm(struct pop_ccb *);
  350. !     void quit_session(struct pop_ccb *);
  351.   
  352.       ccb = (struct pop_ccb *)cb1;
  353.       fsocket.sin_family = AF_INET;
  354. --- 278,285 ----
  355.       char *cp;
  356.       struct sockaddr_in fsocket;
  357.       struct pop_ccb    *ccb;
  358. !     void pop_csm __ARGS((struct pop_ccb *));
  359. !     void quit_session __ARGS((struct pop_ccb *));
  360.   
  361.       ccb = (struct pop_ccb *)cb1;
  362.       fsocket.sin_family = AF_INET;
  363. ***************
  364. *** 347,354 ****
  365.   {
  366.       FILE *mf;
  367.   
  368. !     int mlock (char *,char *);
  369. !     int rmlock (char * ,char *);
  370.       void quit_session __ARGS((struct pop_ccb *));
  371.       /* int mlock __ARGS((char *dir,char *id));   */
  372.       /* int rmlock __ARGS((char *dir,char *id));   */
  373. --- 347,354 ----
  374.   {
  375.       FILE *mf;
  376.   
  377. !     int mlock __ARGS((char *,char *));
  378. !     int rmlock __ARGS((char * ,char *));
  379.       void quit_session __ARGS((struct pop_ccb *));
  380.       /* int mlock __ARGS((char *dir,char *id));   */
  381.       /* int rmlock __ARGS((char *dir,char *id));   */
  382.  
  383.  
  384. *** grinos.orig/popserv.c    Wed Nov 20 16:06:46 1991
  385. --- g/popserv.c    Tue Nov 26 10:35:52 1991
  386. ***************
  387. *** 212,228 ****
  388.   struct pop_scb *scb;
  389.   {
  390.       char password[40];
  391. !     void state_error(struct pop_scb *,char *);
  392. !     void open_folder(struct pop_scb *);
  393. !     void do_cleanup(struct pop_scb *);
  394. !     void read_message(struct pop_scb *);
  395. !     void retrieve_message(struct pop_scb *);
  396. !     void deletemsg(struct pop_scb *,int);
  397. !     void get_message(struct pop_scb *,int);
  398. !     void print_message_length(struct pop_scb *);
  399. !     void close_folder(struct pop_scb *);
  400.   #ifdef POP_FOLDERS
  401. !     void select_folder(struct pop_scb *);
  402.   #endif
  403.   
  404.       if(scb == NULLSCB)
  405. --- 212,228 ----
  406.   struct pop_scb *scb;
  407.   {
  408.       char password[40];
  409. !     void state_error __ARGS((struct pop_scb *,char *));
  410. !     void open_folder __ARGS((struct pop_scb *));
  411. !     void do_cleanup __ARGS((struct pop_scb *));
  412. !     void read_message __ARGS((struct pop_scb *));
  413. !     void retrieve_message __ARGS((struct pop_scb *));
  414. !     void deletemsg __ARGS((struct pop_scb *,int));
  415. !     void get_message __ARGS((struct pop_scb *,int));
  416. !     void print_message_length __ARGS((struct pop_scb *));
  417. !     void close_folder __ARGS((struct pop_scb *));
  418.   #ifdef POP_FOLDERS
  419. !     void select_folder __ARGS((struct pop_scb *));
  420.   #endif
  421.   
  422.       if(scb == NULLSCB)
  423. ***************
  424. *** 369,376 ****
  425.       int deleted = FALSE;
  426.       int msg_no = 0;
  427.       struct stat folder_stat;
  428. !     int newmail(struct pop_scb *);
  429. !     int isdeleted(struct pop_scb *,int);
  430.   
  431.       if (scb->wf == NULL)
  432.           return;
  433. --- 369,376 ----
  434.       int deleted = FALSE;
  435.       int msg_no = 0;
  436.       struct stat folder_stat;
  437. !     int newmail __ARGS((struct pop_scb *));
  438. !     int isdeleted __ARGS((struct pop_scb *,int));
  439.   
  440.  
  441.  
  442.       if (scb->wf == NULL)
  443.           return;
  444. ***************
  445. *** 534,540 ****
  446.   {
  447.       char line[BUF_LEN];
  448.       long cnt;
  449. !     void rrip(char *);
  450.   
  451.       if(scb == NULLSCB)
  452.           return;
  453. --- 534,540 ----
  454.   {
  455.       char line[BUF_LEN];
  456.       long cnt;
  457. !     void rrip __ARGS((char *));
  458.   
  459.       if(scb == NULLSCB)
  460.           return;
  461. ***************
  462. *** 562,568 ****
  463.   {
  464.       char line[BUF_LEN];
  465.       long ftell();
  466. !     void rrip(char *);
  467.   
  468.       if(scb == NULLSCB)
  469.           return;
  470. --- 562,568 ----
  471.   {
  472.       char line[BUF_LEN];
  473.       long ftell();
  474. !     void rrip __ARGS((char *));
  475.   
  476.       if(scb == NULLSCB)
  477.           return;
  478.  
  479.  
  480.  
  481. % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
  482.  
  483. j) And... some outright bugs.  Here's one that you might fix if your
  484.    version of NOS doesn't have it fixed.
  485.  
  486. *** grinos.orig/rspf.c    Wed Nov 20 16:06:57 1991
  487. --- g/rspf.c    Tue Nov 26 10:36:01 1991
  488. ***************
  489. *** 392,398 ****
  490.           goodbadnews(adj);            /* ..that is good news */
  491.       break;
  492.       }
  493. !     stop_timer(&oldadj->timer);        /* stop timer before free() -- KZ1F */
  494.       free((char *)oldadj);
  495.   }
  496.   
  497. --- 392,399 ----
  498.           goodbadnews(adj);            /* ..that is good news */
  499.       break;
  500.       }
  501. !     if(oldadj != NULLADJ)            /* Careful! KA9WSB */
  502. !         stop_timer(&oldadj->timer);        /* stop timer before free() -- KZ1F */
  503.       free((char *)oldadj);
  504.   }
  505.   
  506.  
  507. % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
  508.  
  509. k) Don't forget to update the version.c file so that you know what version
  510.    you happen to be running :-)
  511.  
  512. *** grinos.orig/version.c    Wed Nov 20 16:07:20 1991
  513. --- g/version.c    Tue Nov 26 10:37:52 1991
  514. ***************
  515. *** 2,10 ****
  516.   #include "config.h"
  517.   #include "global.h"
  518.   #include "mbuf.h"
  519. ! char Version[] = "910618 (PA0GRI v1.7j)";
  520. ! char Version2[] = "This version produced by Gerard van der Grinten - PA0GRI";
  521.   int
  522.   doinfo(argc,argv,p)
  523.   int argc;
  524. --- 2,9 ----
  525.   #include "config.h"
  526.   #include "global.h"
  527.   #include "mbuf.h"
  528. ! char Version[] = "910618 (PA0GRI v1.7j) (KA9WSB Tb)";
  529. ! char Version2[] = "This version produced by Gerard van der Grinten - PA0GRI\nPorted to SunOS by KA9WSB";
  530.   int
  531.   doinfo(argc,argv,p)
  532.   int argc;
  533.  
  534. % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
  535.  
  536. l) If you have an older compiler, you might get complaints about a duplicate
  537.    routine.  There is a declaration for "domotd" in the mailbox.c file that
  538.    may upset the compiler.  The simplest fix is to change all references
  539.    to "domotd" to "dombmotd" in the mailbox.c file.
  540.  
  541. % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
  542.  
  543. m) Update the config.h file to reflect your environment.  Note! PPP is
  544.    is so Turbo-C/DOS specific that I haven't been able to get it compiled
  545.    at all.  The Makefile doesn't reference any PPP sources, so don't define
  546.    PPP in config.h.  Following is the file I use:
  547.  
  548. /* Software options */
  549. #define    MAILBOX        1    /* Include SM0RGV mailbox server */
  550. #define    NNTP        1    /* Netnews client */
  551. #define    SERVERS        1    /* Include TCP servers */
  552. #define    TRACE        1    /* Include packet tracing code */
  553. #define    RIP        1    /* Include RIP routing */
  554. #define    HOPCHECK    1    /* IP path tracing command */
  555. #define    DIALER        1    /* SLIP redial code */
  556. #define    NRS        1    /* NET/ROM async interface */
  557. #define    NETROM        1    /* NET/ROM network support */
  558. #undef    LZW        1    /* LZW-compressed sockets */
  559. #define RLOGINCLI    1    /* Rlogin client code */
  560. #define    SLIP        1    /* Serial line IP on built-in ports */
  561. #undef    PPP        1    /* Point-to-Point Protocol code */
  562. #undef    VJCOMPRESS    1    /* Van Jacobson TCP compression for SLIP */
  563. #define    POP        1    /* Include POP2 Post Office Protocol */
  564. #define ESCAPE        1    /* Allow Unix style escape on PC */
  565. #define    RSPF        1    /* Include Radio Shortest Path First Protocol */
  566. #define AXIP        1    /* digipeater via ip port 93 interface */
  567.  
  568. /* Software tuning parameters */
  569. #define    MTHRESH        8192    /* Default memory threshold */
  570. #define    NROWS        25    /* Number of rows on screen */
  571. #define    NIBUFS        5    /* Number of interrupt buffers */
  572. #define    IBUFSIZE    2048    /* Size of interrupt buffers */
  573. #define    NSESSIONS    10    /* Number of interactive clients */
  574. #define DEFNSOCK    40    /* Default number of sockets */
  575.  
  576. /* Hardware driver options */
  577. #undef    ARCNET        1    /* ARCnet via PACKET driver */
  578. #undef    PC_EC        1    /* 3-Com 3C501 Ethernet controller */
  579. #define    KISS        1    /* KISS TNC code */
  580. #undef    HS        1    /* High speed (56kbps) modem driver */
  581. #undef    HAPN        1    /* Hamilton Area Packet Network driver code */
  582. #undef    EAGLE        1    /* Eagle card driver */
  583. #define    PACKET        1    /* FTP Software's Packet Driver interface */
  584. #undef    PC100        1    /* PAC-COM PC-100 driver code */
  585. #undef    APPLETALK    1    /* Appletalk interface (Macintosh) */
  586. #undef    DRSI        1    /* DRSI PCPA slow-speed driver */
  587. #undef    SCC        1    /* PE1CHL generic scc driver */
  588. #undef    PI        1    /* VE3IFB pi dma card scc driver */
  589. #define    ASY        1    /* Asynch driver code */
  590. #undef    SLFP        1    /* SLFP packet driver class supported */
  591.  
  592. % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
  593.  
  594. n) If you want to use the nit driver instead the tunnel driver, you'll have
  595.    to change the Makefile (and cross your fingers!).
  596.  
  597. % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
  598.  
  599. m) Type "make"... then fix all the problems you encounter (easier said than
  600.    done)!
  601.  
  602. % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
  603.  
  604. n) Once you get it compiled, you can test it.  The "test" directory contains
  605.    an incomplete sample directory structure, and a sample startup.nos file.
  606.  
  607. % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
  608.